import request from "@/utils/request";
import pathname from "./pathname";

// 记实列表
export function getReportList(params) {
  return request({
    url: pathname.reportList,
    method: "get",
    params,
    _hasLoading: true
  });
}

// 晾晒列表
export function getReportShowList(params) {
  return request({
    url: pathname.reportShowList,
    method: "get",
    params
  });
}

//新增周记实
export function reportAdd(data) {
  return request({
    url: pathname.reportAdd,
    method: "post",
    data,
    _hasLoading: true
  });
}
//周记实编辑
export function reportUpdate(data) {
  return request({
    url: pathname.reportUpdate,
    method: "post",
    data,
    _hasLoading: true
  });
}
//周记实详情
export function getReportDetail(params) {
  return request({
    url: pathname.reportDetail,
    method: "get",
    params,
    _hasLoading: true
  });
}
export function getReportDetailById(id) {
  return request({
    url: pathname.reportDetailById,
    method: "get",
    params: {
      dataId: id
    }
  });
}
//月记实新增
export function monthReportAdd(data) {
  return request({
    url: pathname.monthReportAdd,
    method: "post",
    data,
    _hasLoading: true
  });
}
// 是否可以修改
export function reportCheckEdit(params) {
  return request({
    url: pathname.reportCheckEdit,
    method: "get",
    params,
    _hasLoading: true
  });
}
// 删除
export function reportDelete(params) {
  return request({
    url: pathname.reportDelete,
    method: "get",
    params,
    _hasLoading: true
  });
}

//月记实编辑
export function monthReportUpdate(data) {
  return request({
    url: pathname.monthReportUpdate,
    method: "post",
    data,
    _hasLoading: true
  });
}

// 当前月周记实
export function reportListByMonth(params) {
  return request({
    url: pathname.reportListByMonth,
    method: "get",
    params,
    _hasLoading: false
  });
}

//月记实详情
export function getMonthReportDetail(params) {
  return request({
    url: pathname.monthReportDetail,
    method: "get",
    params,
    _hasLoading: true
  });
}
export function getMonthReportDetailById(id) {
  return request({
    url: pathname.monthReportDetailById,
    method: "get",
    params: {
      dataId: id
    }
  });
}

// 根据考核周期获取窗口期数据
export function getAddReportList(params) {
  return request({
    url: pathname.getAddReportList,
    method: "get",
    params
  });
}

// 删除文件
export function delFile(id) {
  return request({
    url: pathname.delFile.replace(/{id}/g, id),
    method: "DELETE"
  });
}
